
package display;
import java.util.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.springframework.web.context.*;
import domain.PaisRepository;
import domain.Pais;
import util.PaisDTO;
import util.PaisAssembler;
public class ListaPaises extends PageController {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
PaisRepository paises =
(PaisRepository) context.getBean("PaisRepository");
try {
Collection lista = paises.findAllPais();
List data = new ArrayList();
Iterator itr = lista.iterator();
while (itr.hasNext()) {
Pais prof = (Pais)itr.next();
PaisDTO dto = PaisAssembler.CreateDTO(prof);
data.add(dto);
}
request.setAttribute("paises",data);
forward("/listaPaises.jsp",request,response);
} catch (Exception e) {
request.setAttribute("mensaje",e.getMessage());
forward("/paginaError.jsp",request,response);
}
}}